using UnityEngine;

public class AprilFools_Dynamite : MonoBehaviour
{
	[SerializeField]
	private GameObject ExplosionPrefab;

	[SerializeField]
	private Animator DynamiteAnimator;

	[SerializeField]
	private GameObject ExplosionRadius;

	[SerializeField]
	private float TimeTillBoom = 4f;

	private float elapsedtime;

	private void Awake()
	{
		TimeTillBoom = (TimeTillBoom += Random.Range(-0.2f, 0.2f));
	}

	private void Update()
	{
		elapsedtime += Time.deltaTime;
		DynamiteAnimator.speed = 4f * (elapsedtime / TimeTillBoom);
		if (!ExplosionRadius.activeSelf && base.transform.position.y == 0.5f)
		{
			ExplosionRadius.SetActive(value: true);
		}
		if (ExplosionRadius.activeSelf && base.transform.position.y != 0.5f)
		{
			ExplosionRadius.SetActive(value: false);
		}
		if (elapsedtime > TimeTillBoom)
		{
			Object.Instantiate(ExplosionPrefab, base.transform.position, Quaternion.identity);
			Object.Destroy(base.gameObject);
		}
	}
}
